<template>
  <div>
    <el-badge :value="num" :max="99" class="badge-bell" :hidden="num===0">
      <i class="el-icon-bell bell-svg"></i>
    </el-badge>
  </div>
</template>

<script>
import { getNoticeCount } from '@/api/notice'
export default {
  name: 'Notice',
  data () {
    return {
      num: 0
    }
  },
  mounted () {
    this.getNoticeCount()
    setInterval(() => { this.getNoticeCount() }, 1000 * 60)
  },
  methods: {
    getNoticeCount () {
      getNoticeCount().then(res => {
        this.num = res.num
      })
    }
    // click () {
    //   this.$router.push('/notice')
    // }
  }
}
</script>

<style lang="scss" scoped>
.badge-bell {
  /deep/ .el-badge__content.is-fixed{
    top: 14px;
    right: 14px;
  }
}
.bell-svg {
  display: inline-block;
  cursor: pointer;
  fill: #5a5e66;
  width: 18px;
  height: 18px;
  padding: 0 10px;
}
</style>
